import time

# 非刷新文本进度条
def text_progress_bar_no_refresh(total):
    print("开始执行...")
    for i in range(total + 1):
        percent = i / total * 100
        symbol_num = int(percent / 2)
        symbol_str = "#" * symbol_num + " " * (50 - symbol_num)
        print(f"{percent:.2f}% [{symbol_str}]\r", end="")
        time.sleep(0.1)
    print("\n执行结束！")

# 单行刷新文本进度条
def text_progress_bar_refresh(total):
    print("开始执行...")
    for i in range(total + 1):
        percent = i / total * 100
        symbol_num = int(percent / 2)
        symbol_str = "*" * symbol_num + " " * (50 - symbol_num)
        print(f"{percent:.2f}% [{symbol_str}]")
        time.sleep(0.1)
    print("执行结束！")

text_progress_bar_no_refresh(100)
text_progress_bar_refresh(100)
